#ifndef UTILITIES_H
#define UTILITIES_H

#include <iostream>
#include "vector"

#include "ngl/Camera.h"

/// @file Utilities.h
/// @brief provide basic utility functions
/// @author Perseedoss Rajiv
/// @version 1.0
/// @date 29.03.11
/// Revision History :
/// Initial Version 29.03.11
/// @class Utilities
/// @brief provides central static access to basic routine functions used by all other objects

class Utilities
{
public:
    /// @brief returns a normalised vector
    /// @param[in] _vector the vector to normalise
    /// @param[in] _zeroVector the vector to return if the input vector is 0
    static ngl::Vector normaliseVector
            (
                const ngl::Vector _vector,
                const ngl::Vector _zeroVector=0
            );

    /// @brief scale the magnitude of a vector to a fixed value (vector limiting)
    /// @param[in] _vector the vector to scale
    /// @param[in] _scale the final magnitude to be scaled to
    /// @param[in] _zeroVector the vector to return if the input vector is 0
    static ngl::Vector scaleVectorBy
            (
                const ngl::Vector _vector,
                const float _scale=1.0,
                const ngl::Vector _zeroVector=0
            );

    /// @brief gets the next value given a range of values
    /// @param[in] _current the current value
    /// @param[in] _min the minimum value in the range
    /// @param[in] _max the maximum value in the range
    static int getNext
            (
                const int _current,
                const int _min,
                const int _max
            );

    /// @brief gets the previous value given a range of values
    /// @param[in] _current the current value
    /// @param[in] _min the minimum value in the range
    /// @param[in] _max the maximum value in the range
    static int getPrevious
            (
                const int _current,
                const int _min,
                const int _max
            );

    /// @brief checks if 2 objects have collided with each other
    /// @param[in] _center1 the center position of the first object
    /// @param[in] _radius1 the radius of the first object
    /// @param[in] _center2 the center position of the second object
    /// @param[in] _radius2 the radius of the second object
    /// @param[in] _objectVelocity the velocity of the moving object
    static bool isObjectInsideSphere
            (
                const ngl::Vector _center1,
                const float _radius1,
                const ngl::Vector _center2,
                const float _radius2,
                const ngl::Vector _objectVelocity
            );

    /// @brief determines a velocity vector to steer an object away from some sphere of influence of another object
    /// @param[in] _center1 the center position of the first object
    /// @param[in] _radius1 the radius of the first object
    /// @param[in] _center2 the center position of the second object
    /// @param[in] _enable2DTopView a flag to determine whether the simulation is being done in 2d top view mode
    static ngl::Vector getWorkaroundVelocity
            (
                const ngl::Vector _center1,
                const float _radius1,
                const ngl::Vector _center2,
                const bool _enable2DTopView
            );

};

#endif // UTILITIES_H
